package com.production.CoursePlatform.service;

import com.production.CoursePlatform.entity.LearnReplay;
import com.production.CoursePlatform.mapper.LearnReplayMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LearnReplayService {

    @Autowired
    private LearnReplayMapper learnReplayMapper;

    // 新增学习回复
    public void createLearnReplay(LearnReplay learnReplay) {
        learnReplayMapper.insertLearnReplay(learnReplay);
    }

    // 根据lr_id查找学习回复
    public List<LearnReplay> findLearnReplayByCtId(int ct_id) {
        return learnReplayMapper.selectByCtId(ct_id);
    }


    // 根据lr_id查找学习回复
    public LearnReplay findLearnReplayByLrId(int lr_id) {
        return learnReplayMapper.selectByLrId(lr_id);
    }

    // 根据lr_id删除学习回复
    public boolean deleteLearnReplay(int lr_id) {
        return learnReplayMapper.deleteByLrId(lr_id) > 0;
    }

    // 更新学习回复
    public boolean updateLearnReplay(LearnReplay learnReplay) {
        return learnReplayMapper.updateLearnReplay(learnReplay) > 0;
    }
}

